/**
 * 
 */
package com.cqan.system.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cqan.entity.pk.LongEntity;

/**
 * @Description 版本管理
 * @author slaton.wu@gmail.com
 * @date 2012-7-9下午7:28:25
 *
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "TBL_VERSION_GRADE")
//默认的缓存策略.
@SuppressWarnings("serial")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class VersionUpgrade extends LongEntity {

	public enum VersionGrade{
		//强制升级
		ENFORCE,
		//一般
		GENERAL;
		public String getLabel(){
			switch (this) {
			case ENFORCE:
				return "强制升级";
			case GENERAL:
				return "一般更新";
			}
			return "普通更新";
		}
	}
	
	//app ID
	private Long ab;
	
	//渠道ID
	private String cid;
	
	//说明
	private String description;
	
	//等级
	private VersionGrade grade;
	
	private String title;
	
	private Date updateTime;
	
	private String url;
	
	//最新版本号
	private String version;

	
	@Column(name="CID")
	public String getCid() {
		return cid;
	}

	public void setCid(String cid) {
		this.cid = cid;
	}

	@Column(name="AB")
	public Long getAb() {
		return ab;
	}

	@Column(name="DESCRIPTION",length=500)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name="version_grade")
	@Enumerated(EnumType.STRING)
	public VersionGrade getGrade() {
		return grade;
	}

	@Column(name="TITLE")
	public String getTitle() {
		return title;
	}

	@Column(name="UPDATE_TIME")
	public Date getUpdateTime() {
		return updateTime;
	}

	@Column(name="URL")
	public String getUrl() {
		return url;
	}

	@Column(name="VERSION")
	public String getVersion() {
		return version;
	}

	public void setAb(Long ab) {
		this.ab = ab;
	}


	public void setGrade(VersionGrade grade) {
		this.grade = grade;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setVersion(String version) {
		this.version = version;
	}
	
}
